#ifndef _COMMON_H_
#define _COMMON_H_

#include "public.h"

#define BUF_SIZE 1024
#define TEN_MIN	10*60


int FillArgv(char *p, char *argv[], int *pCount);

int data_get_value(char* recv_, char *co_, int(* fun)(char*, char*));
int get_head(char *recv, char *co);
int get_device_id(char *recv, char *co);
int get_device_type(char *recv, char *co);
int get_humidity(char *recv, char *co);
int get_temperature(char *recv, char *co);
int get_FF(char *recv, char *co);

int cmd_get_value(char* recv_, char *co_, int(* fun)(char *, char *));
int cmd_get_head(char *recv, char *co);
int cmd_get_device_id(char *recv, char *co);
int cmd_get_device_type(char *recv, char *co);
int cmd_get_major(char *recv, char *co);
int cmd_get_min(char *recv, char *co);
int cmd_get_result(char *recv, char *co);
int cmd_get_FF(char *recv, char *co);

enum SYS_ERR_TYPE
{
	SYS_ERROR = -1,
	SYS_OK,
	SYS_DEVICE_REINSERT,  //delete , insert
	SYS_UPDATE_MAX_FD,
};

typedef struct Cmd
{
	unsigned char head;
	unsigned char devID;
	unsigned char devType;
	unsigned char majorCmd;
	unsigned char minCmd;
	unsigned char cmdVal;
	unsigned char reserve1;
	unsigned char reserve2;
	unsigned char tail;
} Cmd;

#endif //_COMMON_H_
